<template>
  <view class="grouplist">
    <view class="grouplist-list">
      <view class="grouplist-list-item" v-for="item in list" :key="item.id" @click="getitem(item.id)">
        {{ item.title }}
      </view>
    </view>
  </view>
</template>

<script lang="ts" setup>
import { ref, reactive } from 'vue'
import { onLoad, onShow } from "@dcloudio/uni-app"
import { agegrouplist } from '@/api/user'
const list: any = ref([])
const id = ref('')
onLoad(async (options: any) => {
  id.value = options.id
  getgroup()
  // console.log(res)
})
const getgroup = async () => {
  const res: any = await agegrouplist(id.value)
  if (res.code == 0) {
    list.value = res.data
  }
}
const getitem = (groupid: any) => {
  uni.setStorageSync('groupid', groupid);
  uni.navigateBack({
    delta: 1 // 表示返回上一级页面，如果 delta 大于 1 则返回多级页面  
  });
  // uni.navigateTo({
  //   url: `/pages/home/index?id=${id.value}&groupid=${groupid}`
  // })
}
</script>

<style lang="scss">
page {
  background-color: #F8F8F8;
}

.grouplist {
  margin: 0 34rpx;

  &-list {
    height: calc(100vh - 100rpx);
    background-color: #fff;
    border-radius: 16rpx;
    margin-top: 20rpx;
    overflow-y: auto;

    &-item {
      border-bottom: 1px solid #EDEDED;
      height: 100rpx;
      line-height: 100rpx;
      margin: 0 20rpx;
      color: #353535;
    }
  }
}
</style>